﻿@{var seesionVar = Session["SELECTED-USER"] as SecurityApi.DataAccess.EnterpriseUser;}

@{
    Layout = "~/Views/Shared/_LayoutManageUser.cshtml";
}

<h3>USER CLAIMS:  @seesionVar.UserName</h3>


@(Html.Kendo().Grid<SecurityApi.DataAccess.UserClaim>()
    .Name("AssignedClaims")
    .HtmlAttributes(new { style = "height:500px;" }) 
    .Columns(columns =>
    {
        //If your grid is ajax bound. You should also define a ClientTemplate for all template columns:
        columns.Template(@<text>
            @Html.ActionLink("Remove", "RemoveUserClaim", "UserClaim", new { userClaimId = @item.UserClaimId})  
            </text>)
        .ClientTemplate("<a href='" + Url.Content("~/UserClaim/RemoveUserClaim/?") + "userClaimId= #= UserClaimId #'" + ">Remove</a>") //always use Url.Content to get the correct relative path
        .Title("").Width(70);
        
        columns.Bound(c => c.Resource.Name).Title("Resource").Width(100);
        columns.Bound(c => c.ClaimType.Name).Title("Claim Type").Width(120);
        columns.Bound(c => c.ClaimType.Uri);
    })
    .Pageable()
    .Selectable()
    .Sortable()
    .Resizable(resize => resize.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
    .Filterable()
    .Scrollable()
    .Groupable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(p => p.UserClaimId))
        .PageSize(50)
        .Read(read => read.Action("AjaxGetAssignedClaims", "UserClaim", new {userId=@seesionVar.UserId})))
    )


